<?php 
require_once '../application/modules/admin/models/Os.php';
require_once '../application/modules/admin/models/Carga.php';

class Admin_MonitoramentoController extends Zend_Controller_Action
{
	public function init()
	{
		if(!Zend_Auth::getInstance()->hasIdentity()){
			$this->_redirect('admin/login');
		}
	}
	
	public function indexAction()
	{
		$usuario = Zend_Auth::getInstance()->getIdentity();
		
		if($usuario->permissao == 1)
		{
			$this->_redirect('admin/monitoramento/transportador');
		}
		else 
		{
			$this->_redirect('admin/monitoramento/cliente');
		}		
	}
	

	public function transportadorAction()
	{
		
	}
   	public function clienteAction()
   	{
      	/*$model = new Application_Modules_Admin_Model_Os();
      	$usuario = Zend_Auth::getInstance()->getIdentity();
      	
      	//$os = $model->find($this->_getParam('id'));
      	$where = $model->getAdapter()->quoteInto("id_usuario = ?",$_GET['id_usuario']);
 
		$this->view->assign("where", $where);
		echo "<pre>";
		echo $where;
		exit;*/
		
   	}
   	
   	public function searchAction()
   	{
      	$model = new Application_Modules_Admin_Model_Carga();
      	$monit = $model->select("codigo = '{$this->_getParam('codigo')}'");
 
		$this->view->assign("monit", $monit);
   	}
}